/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.univcasa.view.forms;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author i.makhloufi
 */
public class passUpdateForm extends org.apache.struts.action.ActionForm {


    private String pass;
    private String ConfPass;


    /**
     *
     */
    public passUpdateForm() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * This is the action called from the Struts framework.
     * @param mapping The ActionMapping used to select this instance.
     * @param request The HTTP Request we are processing.
     * @return
     */
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if (getPass() == null || getPass().length() < 6) {
            errors.add("pass", new ActionMessage("error.pass.required"));
            // TODO: add 'error.name.required' key to your resources
        }
        if (getConfPass() == null || getConfPass().length() < 6) {
            errors.add("confpass", new ActionMessage("error.confpass.required"));
            // TODO: add 'error.name.required' key to your resources
        }
        if (getConfPass() ==null || !getConfPass().equals( getPass() )) {
            errors.add("noconfirm", new ActionMessage("error.pass.confirm"));
            // TODO: add 'error.name.required' key to your resources
        }

        return errors;
    }

    public String getConfPass() {
        return ConfPass;
    }

    public void setConfPass(String ConfPass) {
        this.ConfPass = ConfPass;
    }

    public String getPass() {
        return pass;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }
}
